using System;
using Commons.Utils;

namespace Commons.Models.OperationsContext
{
	public class ReflectionOperationContext : IOperationContext
	{
		protected object data;

		public ReflectionOperationContext(object data)
		{
			this.data = data;
		}

		public bool ContainsKey(string key)
		{
			return ReflectionHelper.GetParameterValue(data, key) != null;
		}

		public object Get(string key)
		{
			return ReflectionHelper.GetParameterValue(data, key);
		}

		public T Get<T>(string key)
		{
			return (T) ReflectionHelper.GetParameterValue(data, key);
		}
	}
}

